package com.jinzihan.entity;

import com.jinzihan.service.ClassroomService;
import com.jinzihan.service.StudentService;
import com.jinzihan.service.impl.ClassroomServiceImpl;
import com.jinzihan.service.impl.StudentServiceImpl;

import java.sql.Date;

public class Order {
    private Integer id;
    private Integer studentId;
    private Integer Status;
    private Date createTime;
    private Integer classroomId;
    private String studentName;

    public Order() {
    }

    public Order(Integer id, Integer studentId, Integer status, Date createTime, Integer classroomId) {
        this.id = id;
        this.studentId = studentId;
        Status = status;
        this.createTime = createTime;
        this.classroomId = classroomId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getStudentId() {
        return studentId;
    }

    public void setStudentId(Integer studentId) {
        this.studentId = studentId;
    }

    public Integer getStatus() {
        return Status;
    }

    public void setStatus(Integer status) {
        Status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getClassroomId() {
        return classroomId;
    }

    public void setClassroomId(Integer classroomId) {
        this.classroomId = classroomId;
    }

    public String getClassroomName(Integer classroomId){
        ClassroomService classroomService = new ClassroomServiceImpl();
        Classroom classroom = classroomService.queryClassroomById(classroomId);
        return classroom.getName();
    }

    public String getStudentName(Integer studentId){
        StudentService studentService = new StudentServiceImpl();
        String username = studentService.queryUsernameById(id);
        return username;
    }

    @Override
    public String toString() {
        return "Order{" +
                "id=" + id +
                ", studentId=" + studentId +
                ", Status=" + Status +
                ", createTime=" + createTime +
                ", classroomId=" + classroomId +
                '}';
    }
}
